<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Message extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'id', 'mobile', 'message_template_id', 'code', 'message', 'send_at', 'overdue_at', 'is_use', 'type',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
    ];

    /**
     * 显示日期时间
     */
    protected $dates = [];

    // 不维护时间戳
    public $timestamps = false;

    /**
     * 模型关联 —— 短信模板
     */
    public function template()
    {
        return $this->belongsTo(MessageTemplate::class, 'message_template_id', 'template_code');
    }
}
